<?php

namespace app\user\model;

use think\db\Query;
use think\Model;

class User extends Model
{
    protected $table = 'user';
    public static function addUser($data){
        return self::create($data);
    }

//    登录
    public static function login($dataInfo){
        return self::where(function ($query) use ($dataInfo) {
            $query->whereOr('username', $dataInfo['username']);
            $query->whereOr('tel', $dataInfo['username']);
            $query->whereOr('email', $dataInfo['username']);
        })->where('password', md5($dataInfo['password']))->find();
    }
}
